// // 测试
const API_BASE_URL = "https://tp8.v4.zhiju001.com/api";
const imgUrl = "https://tp8.v4.zhiju001.com/";
const serviceUrl = ''; // 联系客服
const productionUrl = ''; // 邀请链接

//正式
// const API_BASE_URL = "http://hnlz250814.zhiju001.com/api";
// const imgUrl = "http://hnlz250814.zhiju001.com/";
// const serviceUrl = '';
// const productionUrl = ''; // 邀请链接

const request = (_url, method, data) => {
	let url = API_BASE_URL + _url;
	const location = uni.getStorageSync('location')
	return new Promise((resolve, reject) => {
		uni.request({
			url,
			data,
			method,
			header: {
				token: uni.getStorageSync('token') ? uni.getStorageSync('token') : '',
				// token: 'a8982fd66d8ba73c1db61b6b80fe6b68',
			},
			success: res => {
				resolve(res.data)
			},
			fail: err => {
				reject(err)
			}
		})
	})
}


export default {
	request,
	imgUrl,
	API_BASE_URL,
	productionUrl,
	serviceUrl,

	//获取主题色
	getTheme: data => request('/index/theme', 'get', data),

	//获取个人中心菜单
	getUserMenu: data => request('/index/userMenu', 'get', data),

	getIndexIndex: data => request('/index/index', 'get', data),

	//获取轮播图
	getCarousel: data => request('/index/carousel', 'get', data),
	//获取热搜
	getHotSearch: data => request('/index/searchList', 'get', data),

	//首页接口 - 修改
	getIndexInfo: data => request('/index/info', 'get', data),

	//首页接口
	getUnread: data => request('/index/getUnread', 'get', data),

	//首页接口
	getIndex: data => request('/index/info', 'get', data),

	//相关协议
	getCommunal: data => request('/index/communal', 'get', data),

	//获取视频
	getVideoList: data => request('/video/getList', 'get', data),
	//视频点赞
	videoHit: data => request('/video/hit', 'post', data),
	//视频收藏
	videoCollect: data => request('/video/collect', 'post', data),
	//获取视频评论
	getVideoComments: data => request('/video/getComments', 'get', data),
	//评价视频
	submitComment: data => request('/video/comments', 'post', data),
	//获取七牛云上传凭证
	getQiNiuInfo: data => request('/index/getQiNiuInfo', 'get', data),
	//视频详情
	getVideoInfo: data => request('/video/getInfo', 'get', data),
	//新增视频浏览记录
	addVideoView: data => request('/video/addView', 'put', data),

	//获取商品分类
	getProductCate: data => request('/product/cateList', 'get', data),
	//获取商品
	getProduct: data => request('/product/index', 'get', data),
	//获取商品详情
	getProductInfo: data => request('/product/info', 'get', data),
	//获取商品规格价格
	getProductSpecInfo: data => request('/product/getSpecInfo', 'get', data),
	//立即购买
	productSubmit: data => request('/product/submit', 'post', data),
	//获取购物车
	getCart: data => request('/cart/index', 'get', data),
	//购物车编辑
	editCart: data => request('/cart/edit', 'post', data),
	//添加购物车
	addCart: data => request('/cart/add', 'post', data),
	//购物车结算
	submitCart: data => request('/cart/submit', 'post', data),
	//商品收藏
	collectProduct: data => request('/product/collect', 'post', data),
	//商品评价
	productEvaluateList: data => request('/product/evaluateList', 'get', data),
	//商品二维码
	getProductShareCode: data => request('/product/getShareCode', 'get', data),


	//获取待提交订单
	getOrderTemporary: data => request('/order/getTemporary', 'get', data),
	//提交订单
	orderSubmit: data => request('/order/submit', 'post', data),
	//获取支付方式
	getOrderPayment: data => request('/order/payment', 'get', data),
	//支付订单
	confirmPayment: data => request('/order/confirmPayment', 'post', data),
	//支付成功
	paySuccess: data => request('/order/paySuccess', 'get', data),


	//咨询专栏
	getNews: data => request('/news/index', 'get', data),
	//咨询详情
	getNewsInfo: data => request('/news/info', 'get', data),

	//公告专栏
	getNotice: data => request('/notice/index', 'get', data),
	//公告详情
	getNoticeInfo: data => request('/notice/info', 'get', data),

	//我的钱包
	getAccountWallet: data => request('/account/index', 'get', data),
	//钱包明细
	getAccountIndex: data => request('/account/record', 'get', data),



	//个人中心
	getUserIndex: data => request('/user/index', 'get', data),

	//我的视频
	myVideoList: data => request('/video/myVideoList', 'get', data),
	//删除视频
	deleteVideo: data => request('/video/del', 'post', data),
	//发布视频
	addVideo: data => request('/video/add', 'post', data),
	//视频详情
	myVideoInfo: data => request('/video/myVideoInfo', 'get', data),

	//我的订单
	getMyOrder: data => request('/order/index', 'get', data),
	//我的订单详情
	getMyOrderInfo: data => request('/order/info', 'get', data),
	//订单操作
	editOrder: data => request('/order/edit', 'post', data),
	//修改订单地址
	replaceAddress: data => request('/order/replaceAddress', 'post', data),

	//我的评价
	myEvaluateList: data => request('/product/myEvaluateList', 'get', data),
	//评价详情
	evaluateInfo: data => request('/product/evaluateInfo', 'get', data),
	//退款退货 - 选择商品
	getRefundProduct: data => request('/refund/getRefundProduct', 'get', data),
	//退款退货 - 退款信息
	getRefundFront: data => request('/refund/refundFront', 'get', data),
	//申请退款
	refundSave: data => request('/refund/refundSave', 'post', data),
	//我的售后单
	getMyRefundOrder: data => request('/refund/getMyRefundOrder', 'get', data),
	//我的售后单详情
	getMyRefundOrderInfo: data => request('/refund/getMyRefundOrderInfo', 'get', data),
	//获取快递公司
	getExpress: data => request('/refund/getExpress', 'get', data),
	//上传物流
	editExpress: data => request('/refund/editExpress', 'post', data),


	//留言反馈
	saveMessage: data => request('/message/save', 'post', data),
	//反馈记录
	getMessage: data => request('/message/index', 'get', data),



	//小程序分享码
	getInvitationCode: data => request('/user/getInvitationCode', 'get', data),

	//申请代理
	agentApply: data => request('/agentApply/save', 'post', data),
	//申请代理
	getAgentApply: data => request('/agentApply/index', 'get', data),

	//提现首页
	getDrawIndex: data => request('/draw/index', 'get', data),
	//提现申请
	saveDraw: data => request('/draw/save', 'post', data),
	//提现记录
	getDrawRecord: data => request('/draw/record', 'get', data),

	//我的消息 - 类型
	getNotifyTypeList: data => request('/notify/typeList', 'get', data),

	//我的消息
	getNotify: data => request('/notify/index', 'get', data),

	//我的团队
	getUserTeamList: data => request('/user/myTeamList', 'get', data),
	//我的团队
	getUserTeamTotal: data => request('/user/myTeamTotal', 'get', data),

	//我的地址
	getAddress: data => request('/address/index', 'get', data),
	//地址详情
	getAddressInfo: data => request('/address/info', 'get', data),
	//保存地址
	saveAddressInfo: data => request('/address/save', 'post', data),
	//设置默认
	setDefaultAddress: data => request('/address/setDefault', 'post', data),
	//删除地址
	deleteAddress: data => request('/address/delete', 'post', data),
	//获取省市区
	getArea: data => request('/index/areaList', 'get', data),

	//用户信息
	getUserInfo: data => request('/user/info', 'get', data), //个人资料信息
	saveUser: data => request('/user/edit', 'post', data), //修改用户信息

	//微信授权登录
	wechatAuth: data => request('/login/wechatAuth', 'POST', data),

	methodSave: data => request('/method/save', 'post', data), //获取收款方式信息
	sendSms: data => request('/userCode/sendSms', 'post', data), //发送短信
	userDoMobile: data => request('/user/doMobile', 'post', data), //修改绑定手机号


	getMethodList: data => request('/method/index', 'get', data),
	getMethodInfo: data => request('/method/info', 'get', data), //获取收款方式信息

	wechatRedirect: data => request('/login/wechatRedirect', 'POST', data),



	//充值
	getRemitIndex: data => request('/remit/index', 'get', data),
	//确认充值
	remitPayment: data => request('/remit/save', 'post', data),
	//充值记录
	getRemitRecord: data => request('/remit/record', 'get', data),

	//账号登录
	login: data => request('/login/index', 'post', data),
	//注册
	register: data => request('/register/index', 'post', data),

	//修改密码
	saveSecurity: data => request('/security/save', 'post', data),

	//转账
	getTransfer: data => request('/transfer/index', 'get', data),

	//转账
	saveTransfer: data => request('/transfer/save', 'post', data),

	//转账
	getTransferRecord: data => request('/transfer/record', 'get', data),


	//转换
	getExchange: data => request('/exchange/index', 'get', data),

	//确认转换
	saveExchange: data => request('/exchange/save', 'post', data),

	//转换记录
	getExchangeRecord: data => request('/exchange/record', 'get', data),


	//转换记录
	getExchangeRecord: data => request('/exchange/record', 'get', data),

	//我的安置
	getMyNodeList: data => request('/user/myNodeList', 'get', data),

	//验证会员
	inquiryUser: data => request('/index/inquiryUser', 'get', data),


	//交易-线下
	getTradeOfflineIndex: data => request('/tradeOffline/index', 'get', data),

	//发布挂单
	saveTradeOffline: data => request('/tradeOffline/save', 'post', data),

	//我的挂单
	getTradeOfflineMyRecord: data => request('/tradeOffline/record', 'get', data),

	//撤销挂单
	revokeTradeOffline: data => request('/tradeOffline/revoke', 'post', data),

	//我的买单
	getTradeOfflineMyBuy: data => request('/tradeOffline/myBuy', 'get', data),

	//我的卖单
	getTradeOfflineMySell: data => request('/tradeOffline/mySell', 'get', data),

	//获取交易大厅挂单
	getTradeOfflineHallList: data => request('/tradeOffline/hallList', 'get', data),

	//交易订单
	addTradeOffline: data => request('/tradeOffline/add', 'post', data),

	//交易订单详情 - 卖单
	getTradeOfflineSellInfo: data => request('/tradeOffline/sellInfo', 'get', data),

	//交易订单详情 - 卖单
	getTradeOfflineBuyInfo: data => request('/tradeOffline/buyInfo', 'get', data),

	//打款
	paymentTradeOffline: data => request('/tradeOffline/payment', 'post', data),

	//收款
	receiptTradeOffline: data => request('/tradeOffline/receipt', 'post', data),
	
	//申诉
	appealTradeOffline: data => request('/tradeOffline/appeal', 'post', data),
	
	
	//交易 - 线上
	getTradeOnlineIndex: data => request('/tradeOnline/index', 'get', data),
	
	//获取交易大厅挂单
	getTradeOnlineHallList: data => request('/tradeOnline/hallList', 'get', data),
	
	//发布挂单
	saveTradeOnline: data => request('/tradeOnline/save', 'post', data),
	
	//我的挂单
	getTradeOnlineMyRecord: data => request('/tradeOnline/record', 'get', data),
	
	//撤销挂单
	revokeTradeOnline: data => request('/tradeOnline/revoke', 'post', data),
	
	//交易订单
	addTradeOnline: data => request('/tradeOnline/add', 'post', data),
	

	//我的买单
	getTradeOnlineMyBuy: data => request('/tradeOnline/myBuy', 'get', data),
	
	//我的卖单
	getTradeOnlineMySell: data => request('/tradeOnline/mySell', 'get', data),
	
	/**
	 * 验证是否有原密码
	 */
	getSecurityIndex: () => request('/security/index', 'get'),//验证是否有原密码
	
}